﻿Imports Aricie.DNN.Modules.LuceneSearch.ModuleProviders
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Services.Search
Imports DotNetNuke.Common.Utilities
Imports Aricie.DNN.Modules.LuceneSearch.Business
Imports System.Linq
Imports System.Data
Imports Mandeeps.DNN.Modules.LiveTabs


Namespace Aricie.DNN.Modules.LuceneSearch.ModuleProviders

    Public Class LiveTabsProvider
        Implements ILuceneSearchableUpgrade

        Public Sub UpgradeSearchItem(ByVal portalId As Integer, ByRef searchItem As Aricie.DNN.Modules.LuceneSearch.Business.LuceneSearchItemInfo) Implements Aricie.DNN.Modules.LuceneSearch.ModuleProviders.ILuceneSearchableUpgrade.UpgradeSearchItem

            ' bizarrement, les ids sont stockés avec l'id de module... on le supprime avant tout traitement.
            Dim TabId As Integer = Integer.Parse(searchItem.SearchKey.Substring(searchItem.ModuleId.ToString.Length))
            Dim t As Tab = LiveTabs.GetModule(searchItem.ModuleId).GetTab(TabId)
            For Each permission As Integer In t.Permissions
                searchItem.ItemViewRoleIds.Add(permission)
            Next

            searchItem.ItemType = "Onglet"
        End Sub

    End Class

End Namespace